<template>
  <text :style="{ color: color, 'font-size': size, 'font-family': type }" @click="_onClick">{{ value }}</text>
</template>

<script>
// #ifdef APP-NVUE
var domModule = weex.requireModule('dom');
// domModule.addRule('fontFace', {
//   fontFamily: 'Regular',
//   src: "url('https://gxfacepay.oss-cn-shenzhen.aliyuncs.com/wlkmini/font/PingFangRegular2.ttf')"
// });
domModule.addRule('fontFace', {
  fontFamily: 'Medium',
  src: "url('/static/font/PingFangMedium.ttf')"
});
domModule.addRule('fontFace', {
  fontFamily: 'Bold',
  src: "url('/static/font/PingFangBold.ttf')"
});
domModule.addRule('fontFace', {
  fontFamily: 'Heavy',
  src: "url('/static/font/PingFangHeavy.ttf')"
});
domModule.addRule('fontFace', {
  fontFamily: 'Bahnschrift',
  src: "url('/static/font/Bahnschrift.ttf')"
});
// #endif
/**
 * nvue下使用的text组件
 * @description nvue下使用的text组件
 * @property {String} type = [Medium|Bold|Heavy|Bahnschrift] 字体
 * 	@value Medium 中粗
 * 	@value Bold 粗体
 * 	@value Heavy 超粗
 * 	@value Bahnschrift 数字
 * @event {Function} tap 点击事件
 */
export default {
  name: 'jhText',
  props: {
    type: {
      type: String,
      default: 'Medium'
    },
    color: {
      type: String,
      default: '#333'
    },
    size: {
      type: [Number, String],
      default: '24px'
    },
    value: {
      type: [Number, String],
      default: ''
    }
  },
  methods: {
    _onClick() {
      this.$emit('click');
    }
  }
};
</script>
